<?php

namespace Mvc\App\Decorator;

use Mvc\App\Decorator\Interfaces\TemplateInterface;

/**
 * Created by PhpStorm.
 * User: 554665488
 * Date: 2018-6-22
 * Time: 3:39
 * @description: 装饰器 模板装饰器
 * @Author: yfl
 * @QQ 554665488
 */
class Template implements TemplateInterface
{
    protected $controller;

    public function beforeAction($controller)
    {
        // TODO: Implement beforeRequest() method.
        $this->controller = $controller;
    }

    public function afterAction($return_value)
    {
        // TODO: Implement afterRequest() method.
        foreach ($return_value as $k => $v) {
            $this->controller->assign($k, $v);
        }
        $this->controller->display();
    }

}